<template>
  <div>
    <ElDrawer v-model="visible">
      <ElDescriptions>
        <ElDescriptionsItem label="贷款编号">
          <ElTag>{{ loanBill.loanCode }}</ElTag></ElDescriptionsItem
        >
        <ElDescriptionsItem label="贷款状态">{{ loanBill.billState }}</ElDescriptionsItem>
        <ElDescriptionsItem label="贷款种类">{{ loanBill.materialCode }}</ElDescriptionsItem>
        <ElDescriptionsItem label="贷款银行">{{ loanBill.loanBank }}</ElDescriptionsItem>
        <ElDescriptionsItem label="贷款金额">{{ loanBill.applyAmount }}</ElDescriptionsItem>
        <ElDescriptionsItem label="营业执照">{{ loanBill.bizLicense }}</ElDescriptionsItem>
        <ElDescriptionsItem label="对公账号">{{ loanBill.bizCard }}</ElDescriptionsItem>
        <ElDescriptionsItem label="审核意见">
          <ElInput v-model="loanBill.secondAuditWord"></ElInput>
        </ElDescriptionsItem>
      </ElDescriptions>
      <ElButton type="primary" @click="audit(1)">二审通过</ElButton>
      <ElButton type="warning" @click="audit(0)">二审不通过</ElButton>
    </ElDrawer>
  </div>
</template>
<script lang="ts" setup>
const loanBill: any = reactive({
  loanCode: '',
  billState: 'toSubmit',
  loanApplier: '',
  materialCode: '',
  applyAmount: 0,
  loanBank: '',
  firstAuditTime: null,
  firstAuditWord: '',
  secondAuditTime: null,
  secondAuditWord: '',
  version: 0,
  updateTime: null,
  firstAuditor: '',
  bizCard: '',
  bizLicense: ''
})
const visible = ref(false)
const show = (data: any) => {
  Object.assign(loanBill, data)
  visible.value = true
}
defineExpose({
  show
})
const emit = defineEmits(['postAudit'])
const audit = async (score:number) => {
  const res = await axios({
    method: 'put',
    url: 'http://localhost:9091/loanBill/auditSecond/'+score,
    data: loanBill
  })
  visible.value = false
  emit('postAudit', 1)
}

</script>
<style lang="scss" scoped></style>
